import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpEnroll {
  id!: number;
  formId!: number;
  title!: string;
  desc?: string;
  img!: unknown;
  type!: number;
  typeId!: number;
  content!: unknown;
  sort: number = 0;
  priceType!: boolean;
  price?: string;
  linePrice?: string;
  state!: boolean;
  stock!: number;
  zongNum: number = 0;
  viewNum: number = 0;
  defaultView!: number;
  sales: number = 0;
  virtualSales!: number;
  integral: number = 0;
  enrollStratTime!: string;
  enrollEndTime!: string;
  activeStratTime!: string;
  activeEndTime!: string;
  address?: string;
  longitude?: string;
  latitude?: string;
  name!: string;
  phone!: string;
  uniacid!: number;
  showLog: boolean = true;
  addTime!: string;
  updateTime!: string;
}

export const ImsYzdKpEnrollSchema = new EntitySchema({
  class: ImsYzdKpEnroll,
  properties: {
    id: { primary: true, type: 'number' },
    formId: { type: 'number' },
    title: { type: 'string', length: 255 },
    desc: { type: 'string', length: 255, nullable: true },
    img: { type: 'unknown', columnType: 'longtext' },
    type: { type: 'number' },
    typeId: { type: 'number' },
    content: { type: 'unknown', columnType: 'longtext' },
    sort: { type: 'number', default: 0 },
    priceType: { type: 'boolean' },
    price: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    linePrice: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    state: { type: 'boolean' },
    stock: { type: 'number' },
    zongNum: { type: 'number', default: 0 },
    viewNum: { type: 'number', default: 0 },
    defaultView: { type: 'number' },
    sales: { type: 'number', default: 0 },
    virtualSales: { type: 'number' },
    integral: { type: 'number', default: 0 },
    enrollStratTime: { type: 'string', length: 255 },
    enrollEndTime: { type: 'string', length: 255 },
    activeStratTime: { type: 'string', length: 255 },
    activeEndTime: { type: 'string', length: 255 },
    address: { type: 'string', length: 255, nullable: true },
    longitude: { type: 'string', length: 255, nullable: true },
    latitude: { type: 'string', length: 255, nullable: true },
    name: { type: 'string', length: 255 },
    phone: { type: 'string', length: 255 },
    uniacid: { type: 'number' },
    showLog: { type: 'boolean', default: true },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
  },
});
